package drds.binlog.data_object;

import drds.binlog.common.Authors;
import drds.common.Author;

/**
 * 事件类型
 */
@Author(name = Authors.LI_YANG)
public enum EventType
{

    eventtypecompatibleproto2(0),

    insert(1),

    update(2),

    delete(3),

    create(4),

    alter(5),

    erase(6),

    query(7),

    truncate(8),
    rename(9),
    create_index(10),

    drop_index(11),

    gtid(12),

    xa_commit(13),

    xa_rollback(14),
    master_heartbeat(15),
    unrecognized(-1),;


    private final int value;

    private EventType(int value)
    {
        this.value = value;
    }


    public static EventType valueOf(int value)
    {

        switch (value)
        {
            case 0:
                return eventtypecompatibleproto2;
            case 1:
                return insert;
            case 2:
                return update;
            case 3:
                return delete;
            case 4:
                return create;
            case 5:
                return alter;
            case 6:
                return erase;
            case 7:
                return query;
            case 8:
                return truncate;
            case 9:
                return rename;
            case 10:
                return create_index;
            case 11:
                return drop_index;
            case 12:
                return gtid;
            case 13:
                return xa_commit;
            case 14:
                return xa_rollback;
            case 15:
                return master_heartbeat;
            default:
                return null;
        }
    }


}
